<div id="page-heading"><h1><?php echo sprintf(lang('dailyplans.manage_title'), def_lang($tour, 'name', CURRENT_LANGUAGE)); ?></h1></div>
<?php $this->load->view('partials/notices'); ?>
<?php if ($dailyplans): ?>
<?php echo form_open('admin/catalog/action_dailyplan/'. $tour->id, 'id="mainform"');?>
<table cellspacing="0" cellpadding="0" border="0" width="100%" id="product-table">
				<tbody>
				<tr>
				<?php if (group_has_role('catalog', 'delete_dailyplan')): ?>
					<th class="table-header-check"><a id="toggle-all" ></a> </th>
				<?php endif;?>
					<th class="table-header-repeat line-left"><a href="javascript:void(0);"><?php echo lang('dailyplans.name_label'); ?></a></th>
					<th class="table-header-repeat line-left" style="display:none;"><a href="javascript:void(0);"><?php echo lang('dailyplans.tour_id'); ?></a></th>
					<th class="table-header-repeat line-left"><a href="javascript:void(0);"><?php echo lang('dailyplans.day'); ?></a></th>
					<th class="table-header-repeat line-left"><a href="javascript:void(0);"><?php echo lang('dailyplans.departure_city_id'); ?></a></th>
					<th class="table-header-repeat line-left"><a href="javascript:void(0);"><?php echo lang('dailyplans.destination_city_id'); ?></a></th>
					<th class="table-header-repeat line-left"><a href="javascript:void(0);"><?php echo lang('dailyplans.hotel_id'); ?></a></th>
					<th class="table-header-repeat line-left"><a href="javascript:void(0);"><?php echo lang('global:actions')?></a></th>
				</tr>
				<?php foreach ($dailyplans as $key => $dailyplan): ?>
				<tr <?php if($key%2 == 0):?>class="alternate-row"<?php endif;?>>
					<?php if (group_has_role('catalog', 'delete_dailyplan')): ?>
						<td><?php echo form_checkbox('action_to[]', $dailyplan->id); ?></td>
					<?php endif; ?>
					<td><?php echo anchor('admin/catalog/edit_dailyplan/' . $dailyplan->tour_id. '/'. $dailyplan->id, $dailyplan->name, 'title="' . $dailyplan->name .'" class="folder-hash"'); ?></td>
					<td style="display:none;"><?php echo$dailyplan->tour_id?></td>
					<td><?php echo $dailyplan->day?></td>
					<td>
					<?php 
					foreach($cities as $city){
						if($dailyplan->departure_city_id == $city->id){
							echo $city->name;
							break;
						}
					}
					?>
					</td>
					<td>
					<?php 
					foreach($cities as $city){
						if($dailyplan->destination_city_id == $city->id){
							echo $city->name;
							break;
						}
					}
					?>
					</td>
					<td>
					<?php 
					if(!empty($dailyplan->hotel_id)){
						foreach($hotels as $hotel){
							if($hotel->id == $dailyplan->hotel_id){
								echo $hotel->name;
								break;
							}
						}
					}
					?>
					</td>
					<td class="options-width">
					<?php if (group_has_role('catalog', 'edit_dailyplan')): ?>
						<?php echo anchor('admin/catalog/edit_dailyplan/' . $tour->id. '/'. $dailyplan->id, ' ', 'title="'. lang('buttons.edit').'" class="icon-1 info-tooltip"'); ?>
						<?php endif; ?>
						<?php if (group_has_role('catalog', 'delete_dailyplan')): ?>
						<a class="icon-2 info-tooltip" title="<?php echo lang('buttons.delete');?>" href="javascript:void(0);" onclick="if(confirm('<?php echo lang('global:delete')?>')){window.location.href='<?php echo site_url('admin/catalog/delete_dailyplan/' . $tour->id. '/'. $dailyplan->id);?>'}"></a>
						<?php endif; ?>
					</td>
				</tr>
				<?php endforeach;?>
				</tbody>
</table>
<input type="hidden" name="btnAction"  id="btnAction" value=""/>
<?php if (group_has_role('catalog', 'delete_dailyplan')): ?>
<script type="text/javascript">
	function submit_form(type)
	{
		if('delete' == type){
			if(confirm('<?php echo lang("global:delete_confirm")?>')){
				$('#btnAction').val('delete');
				$('#mainform').submit();
			}
		}
	}
</script>
<div id="actions-box">
	<a href="" class="action-slider"></a>
	<div id="actions-box-slider">
		<a href="javascript:void(0);" onclick="submit_form('delete');" class="action-delete">Delete</a>
	</div>
	<div class="clear"></div>
</div>
<div align=center><div class="inner"><?php $this->load->view('partials/pagination'); ?></div></div>
<?php endif; ?>
<?php echo form_close();?>

<?php else: ?>
	<div class="no_data file-dailyplans">
		<p><?php echo lang('dailyplans.no_dailyplan');?></p>
		<br />
		<p>[<a href="<?php echo site_url('admin/catalog/create_dailyplan/'. $tour->id)?>"><?php echo lang('menu_2_catalog_create_dailyplan')?></a>]</p>
	</div>
<?php endif; ?>